Skip to content

feat(facebookpixel): add facebookpixelOpenBridge option - #1419

Merged
AmauriC merged 1 commit into
AmauriC:masterfrom
winzou:feat/facebookpixel-openbridge
Nov 9, 2026
Merged

AmauriC merged 1 commit into
AmauriC:masterfrom
winzou:feat/facebookpixel-openbridge

Conversation

@winzou

@winzou winzou commented Oct 29, 2026

Copy link
Copy Markdown

What

Adds an optional tarteaucitron.user.facebookpixelOpenBridge setting to the facebookpixel service. When it is a string (the gateway URL), the service calls fbq('set', 'openbridge', facebookpixelId, <url>) before fbq('init'). When it is not set, nothing changes.

tarteaucitron.user.facebookpixelId = '123456789012345';
tarteaucitron.user.facebookpixelOpenBridge = 'https://capig.example.com';
(tarteaucitron.job = tarteaucitron.job || []).push('facebookpixel');

Why

Meta's Conversions API Gateway (hosted by Meta on AWS, or by partners such as Stape) relays pixel events server-side. The pixel only uses a gateway if fbq('set', 'openbridge', ...) runs before fbq('init'). facebookpixelMore runs after init and PageView, so it cannot be used for this, and the service's if (window.fbq) return; prevents defining fbq beforehand. Without this option, a site has to replace the whole service.

Consent behaviour is unchanged: the line only runs inside the service's js, so it only runs after the visitor accepts facebookpixel.

How I checked

Local page with tarteaucitron 1.37.0 and Meta's real fbevents.js (www.facebook.com blocked, network log recorded):

Setup signals/plugins/openbridge3.js requested?
Unpatched no
fbq('set','openbridge',…) in facebookpixelMore no
This PR with facebookpixelOpenBridge set yes
This PR without the option no, same requests as before

I could not test an armed gateway end to end, because it needs a pixel connected to a live gateway.

Only tarteaucitron.services.js is changed. I left tarteaucitron.services.min.js for the regular minification pass.

🤖 Generated with Claude Code

Lets the Meta Pixel send its events to a Conversions API Gateway endpoint.
The openbridge setting has to be applied before fbq('init'), which the
existing facebookpixelMore hook (called after init and PageView) cannot do.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AmauriC
AmauriC merged commit 4affce6 into AmauriC:master Nov 9, 2026
1 check passed
@winzou
winzou deleted the feat/facebookpixel-openbridge branch November 9, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants